var  userDB = require('../models/user')
, mongoose = require('mongoose');


var test;
// the middleware function
module.exports = function(mailR) {
    mongoose.connect('mongodb://localhost/blog');
    userDB.User.findOne({ mail: mailR }, function (err, usr){
    mongoose.connection.close();
       if(usr != null){
             test = usr;
          }
        console.log(test);
    });

};